package practice.test3.studentRecord.plan1;

import org.apache.hadoop.io.Writable;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

public class StuBean implements Writable {

    private String StuName;

    private String MathScore;

    private String EngScore;

    private String ChScore;

    private String total;

    private String average;

    private String flag;

    public StuBean() {

    }

    public String getStuName() {
        return StuName;
    }

    public void setStuName(String stuName) {
        StuName = stuName;
    }

    public String getMathScore() {
        return MathScore;
    }

    public void setMathScore(String mathScore) {
        MathScore = mathScore;
    }

    public String getEngScore() {
        return EngScore;
    }

    public void setEngScore(String engScore) {
        EngScore = engScore;
    }

    public String getChScore() {
        return ChScore;
    }

    public void setChScore(String chScore) {
        ChScore = chScore;
    }

    public String getTotal() {
        return total;
    }

    public void setTotal(String total) {
        this.total = total;
    }

    public String getAverage() {
        return average;
    }

    public void setAverage(String average) {
        this.average = average;
    }

    public String getFlag() {
        return flag;
    }

    public void setFlag(String flag) {
        this.flag = flag;
    }

    @Override
    public String toString() {
        return StuName + "\t" + "数学："+MathScore + " 英语：" +EngScore + " 语文：" + ChScore + " " + "总分：" + total + " " +"\t" + "平均分：："+ average;
    }

    @Override
    public void write(DataOutput out) throws IOException {

        out.writeUTF(StuName);
        out.writeUTF(MathScore);
        out.writeUTF(EngScore);
        out.writeUTF(ChScore);
        out.writeUTF(total);
        out.writeUTF(average);
    }

    @Override
    public void readFields(DataInput in) throws IOException {

        this.StuName = in.readUTF();
        this.MathScore = in.readUTF();
        this.EngScore = in.readUTF();
        this.ChScore = in.readUTF();
        this.total = in.readUTF();
        this.average = in.readUTF();

    }
}
